/*
 * Copyright (c) 2025 EasyAdmin
 * All rights reserved.
 *
 * This file is part of the [EasAdmin] project.
 * Unauthorized copying of this file, via any medium, is strictly prohibited.
 * Proprietary and confidential.
 *
 * Author: EasyAdmin ( 1073602@qq.com )
 * Website: https://www.xhxiao.com
 */
package com.easy.module.log.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.easy.framework.common.validate.Add;
import com.easy.framework.common.validate.Update;
import com.easy.framework.database.entity.BaseEntity;
import com.easy.framework.poi.annotation.Excel;
import com.easy.framework.poi.annotation.Option;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

/**
 * 登录日志 实体
 *
 * @author EasyAdmin ( 1073602@qq.com )
 * @date 2025-08-19
 */
@Getter
@Setter
@TableName("sys_login_log")
public class SysLoginLog extends BaseEntity
{

    private static final long serialVersionUID = 1L;


    /**
     * 编号
     *
     */
    @Excel(name = "编号")
    @TableId(type = IdType.AUTO)
    private Long id;


    /**
     * 登录用户名
     *
     */
    @Excel(name = "登录用户名")
    @Size(message = "登录用户名长度必须小于50个字符", max = 50, groups = {Add.class, Update.class})
    private String username;

    /**
     * 授权类型
     *
     */
    @Excel(name = "授权类型")
    @Size(message = "授权类型名长度必须小于20个字符", max = 20, groups = {Add.class, Update.class})
    private String grantType;


    /**
     * 设备
     *
     */
    @Excel(name = "设备")
    @Size(message = "设备长度必须小于50个字符", max = 50, groups = {Add.class, Update.class})
    private String device;


    /**
     * 系统
     *
     */
    @Excel(name = "系统")
    @Size(message = "系统长度必须小于50个字符", max = 50, groups = {Add.class, Update.class})
    private String os;


    /**
     * 浏览器
     *
     */
    @Excel(name = "浏览器")
    @Size(message = "浏览器长度必须小于50个字符", max = 50, groups = {Add.class, Update.class})
    private String browser;


    /**
     * 登录IP
     *
     */
    @Excel(name = "登录IP")
    @Size(message = "登录IP长度必须小于128个字符", max = 128, groups = {Add.class, Update.class})
    private String ip;


    /**
     * 登录地点
     *
     */
    @Excel(name = "登录地点")
    @Size(message = "登录地点长度必须小于255个字符", max = 255, groups = {Add.class, Update.class})
    private String location;


    /**
     * 状态（0正常 1异常）
     *
     */
    @Excel(
            name = "状态",
            options = {
                    @Option(value = "0", name = "正常"),
                    @Option(value = "1", name = "异常")
            }
    )
    @NotNull(message="状态不能为空", groups = {Add.class,Update.class})
    private Integer status;


    /**
     * 模块标题
     *
     */
    @Excel(name = "模块标题")
    @Size(message = "模块标题长度必须小于50个字符", max = 50, groups = {Add.class, Update.class})
    private String msg;


    /**
     * 登录时间
     *
     */
    @Excel(name = "登录时间")
    private Date loginAt;

}